﻿@using Utry.Framework.Mvc
@model Utry.CI.Models.ProjectModel
@{
    ViewBag.Title = "项目列表";
}

<div style="margin-top:60px;">
<form name="form1" method="post" action="@Url.Action("checklist", "Project")" >
@Html.JPartial("_Notifications")
<div class="table-toolbar">

    <div class="btn-group">
          <a id="sample_editable_1_new" class="btn btn-sm btn-success"  href="@Url.Action("ProjectAdd", "Project")" >
             添加项目 <i class="icon-plus"></i>
          </a>
    </div>

      <div class="btn-group">
           	<input type="text" name="ProjectName" id="ProjectName" placeholder="项目名称" value="@Model.ProjectName" class="form-control" style="width:180px;"/>
      </div>

      <div class="btn-group">
           	<input type="text" name="ProjectCode" id="ProjectCode" placeholder="项目编号" value="@Model.ProjectCode" class="form-control" style="width:180px;"/>
      </div>

      <div class="btn-group">
            <button type="button" class="btn btn-sm btn-success" onclick="query()"><i class="icon-search"></i></button>      </div>
   
                      
</div>


<table class="table table-striped table-bordered table-hover" id="projectlist">
        <thead>
          <tr>
            <th>项目名称</th>
            <th>项目编号</th>
            <th>测试地址</th>
            <th>发布状态</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>

         @foreach (var item in Model.ProjectList)
         {
          <tr>
           <td><a href="@Url.Action("ProjectInfo", "project", new { Id = item.ID })">@item.ProjectName </a></td>
            <td>@item.ProjectCode </td>
            <td>@item.ProjectTestURL </td>
            <td>@Html.Raw(Utry.Framework.Utils.TypeConverter.ObjectToString(item.Status).Replace("发布中", "<span class=\"label label-sm label-warning\">发布中</span> &nbsp;").Replace("发布成功", "<span class=\"label label-sm label-success\">发布成功</span> &nbsp;").Replace("发布失败", "<span class=\"label label-sm label-danger\">发布失败</span> &nbsp;"))  </td>
            <td>
               <div class="btn-group">
                  <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                    操作 <span class="caret"></span>
                  </button>
                      @if (ViewBag.Role == "管理员" || ViewBag.Role == "版本发布人员" || ViewBag.Role == "开发组长")
                      { 
                        <ul class="dropdown-menu" role="menu">
                        <li><a href="@Url.Action("ProjectAdd", "project", new { Id = item.ID })">修改</a></li>
                        <li><a href="@Url.Action("DeleteProject", "project", new { Id = item.ID })" onclick="return confirm('确定删除?');">删除</a></li>
                        @if (item.Status != "发布中")
                        { 
                            <li><a href="@Url.Action("ProjectReleaseInfo", "project", new { id = item.ID })">发布</a></li>
                        }
                        <li><a href="@Url.Action("ProjectInfo", "project", new { id = item.ID })">查看</a></li>
                        </ul>
                      }
                </div>
             </td>
          </tr>
         }

        </tbody>
      </table>


<div id="pager"><ul class="pagination">@Html.Pager(Model.PageList).ShowIndividualPages(true)</ul> </div>
</form>
</div>

<script type="text/javascript">
    //查询
    function query() {
        document.forms[0].action = '@Url.Action("Projectlist", "Project")';
        document.forms[0].method = 'post';
        document.forms[0].submit();
    }
</script>



